package com.ktgj.customer.service.impl;

import java.util.List;
import com.ktgj.common.core.utils.DateUtils;
import com.ktgj.customer.domain.MallActivityProductSpec;
import com.ktgj.customer.domain.vo.MallProductSpecVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktgj.customer.mapper.MallProductSpecMapper;
import com.ktgj.customer.domain.MallProductSpec;
import com.ktgj.customer.service.IMallProductSpecService;

/**
 * 商品规格Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-05-30
 */
@Service
public class MallProductSpecServiceImpl implements IMallProductSpecService 
{
    @Autowired
    private MallProductSpecMapper mallProductSpecMapper;

    /**
     * 查询商品规格
     * 
     * @param productSpecId 商品规格ID
     * @return 商品规格
     */
    @Override
    public MallProductSpec selectMallProductSpecById(Long productSpecId)
    {
        return mallProductSpecMapper.selectMallProductSpecById(productSpecId);
    }

    /**
     * 查询商品规格列表
     * 
     * @param mallProductSpec 商品规格
     * @return 商品规格
     */
    @Override
    public List<MallProductSpec> selectMallProductSpecList(MallProductSpec mallProductSpec)
    {
        return mallProductSpecMapper.selectMallProductSpecList(mallProductSpec);
    }

    /**
     * 新增商品规格
     * 
     * @param mallProductSpec 商品规格
     * @return 结果
     */
    @Override
    public int insertMallProductSpec(MallProductSpec mallProductSpec)
    {
        mallProductSpec.setCreateTime(DateUtils.getNowDate());
        return mallProductSpecMapper.insertMallProductSpec(mallProductSpec);
    }

    /**
     * 修改商品规格
     * 
     * @param mallProductSpec 商品规格
     * @return 结果
     */
    @Override
    public int updateMallProductSpec(MallProductSpec mallProductSpec)
    {
        mallProductSpec.setUpdateTime(DateUtils.getNowDate());
        return mallProductSpecMapper.updateMallProductSpec(mallProductSpec);
    }

    /**
     * 修改商品规格
     *
     * @param mallProductSpec 商品规格
     * @return 结果
     */
    @Override
    public int updateMallProductSpecByProId(MallProductSpec mallProductSpec)
    {
        mallProductSpec.setUpdateTime(DateUtils.getNowDate());
        return mallProductSpecMapper.updateMallProductSpecByProId(mallProductSpec);
    }

    /**
     * 批量删除商品规格
     * 
     * @param productSpecIds 需要删除的商品规格ID
     * @return 结果
     */
    @Override
    public int deleteMallProductSpecByIds(Long[] productSpecIds)
    {
        return mallProductSpecMapper.deleteMallProductSpecByIds(productSpecIds);
    }

    /**
     * 删除商品规格信息
     * 
     * @param productSpecId 商品规格ID
     * @return 结果
     */
    @Override
    public int deleteMallProductSpecById(Long productSpecId)
    {
        return mallProductSpecMapper.deleteMallProductSpecById(productSpecId);
    }

    @Override
    public List<MallProductSpecVO> mallProductSpecList(Long productId) {
        return mallProductSpecMapper.mallProductSpecList(productId);
    }

    //活动商品规格信息
    @Override
    public List<MallActivityProductSpec> productSpecs(Long productId) {
        return mallProductSpecMapper.productSpecs(productId);
    }
}
